import Cookies from 'js-cookie'

const TokenKey = 'YunYin-Token'

export function getToken() {
  return Cookies.get(TokenKey)
}

export function setToken(token) {
  return Cookies.set(TokenKey, token)
}

export function removeToken() {
  return Cookies.remove(TokenKey)
}

// 验证码
const TokenKeyByCode = 'Code-Token'
export function getCodeToken() {
  return Cookies.get(TokenKeyByCode)
}

export function setCodeToken(token) {
  return Cookies.set(TokenKeyByCode, token)
}

export function removeCodeToken() {
  return Cookies.remove(TokenKeyByCode)
}

// 设置
const FinanceKey = 'finance-Token'

export function setFinance(finance) {
  return Cookies.set(FinanceKey, finance)
}
export function getFinance(finance) {
  return Cookies.getJSON(FinanceKey)
}
export function removeFinance() {
  return Cookies.remove(FinanceKey)
}
// 设置用户信息
const UserKey = 'YunYin-User-Token'

export function setUser(user) {
  return Cookies.set(UserKey, user)
}
export function getUser(finance) {
  return Cookies.getJSON(UserKey)
}
export function removeUser() {
  return Cookies.remove(UserKey)
}
